package com.code.day14;

/*
* 某公司人事举办了这样一个活动,凡是入职6周年的员工,赠送一个精美小礼品,于是员工纷纷去计算了自己的入职年限,请设计程序,帮同事们计算出入职年限.
 * */

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.logging.SimpleFormatter;

public class Test2 {
    public static void main(String[] args) throws ParseException {
        String joinDate = "2019-01-01";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        long joinTime = sdf.parse(joinDate).getTime();
        long nowTime = System.currentTimeMillis();
        long betweenTime = nowTime - joinTime;
        long day = betweenTime / ( 24 * 60 * 60 * 1000);
        int joinYear = (int) (day / 365);
        System.out.println("入职"+joinYear+"年");

    }
}
